[{"id":"34eaaa0e.725cc6","type":"inject","z":"9a61955d.6927f8","name":"test","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":140,"wires":[["7cdcbb1.7611944"]]},{"id":"7cdcbb1.7611944","type":"ui_button","z":"9a61955d.6927f8","name":"","group":"d920f16c.f3336","order":2,"width":0,"height":0,"passthru":true,"label":"New Picture","tooltip":"","color":"","bgcolor":"","icon":"","payload":"0","payloadType":"num","topic":"","x":150,"y":200,"wires":[["6a7806b3.548528"]]},{"id":"6a7806b3.548528","type":"http request","z":"9a61955d.6927f8","name":"","method":"GET","ret":"bin","paytoqs":false,"url":"https://loremflickr.com/320/240/person","tls":"","persist":false,"proxy":"","authType":"","x":330,"y":200,"wires":[["25a15a91.03a146","aeafe8b.5c1f918"]]},{"id":"25a15a91.03a146","type":"base64","z":"9a61955d.6927f8","name":"","action":"str","property":"payload","x":520,"y":140,"wires":[["b3082738.d420d8"]]},{"id":"aeafe8b.5c1f918","type":"tensorflowCoco","z":"9a61955d.6927f8","name":"","model":"","scoreThreshold":"","x":530,"y":260,"wires":[["758e8b99.628f54","7242bb6a.16a664","7fb61cf1.74a9d4","52d5e6be.efb998"]]},{"id":"b3082738.d420d8","type":"ui_template","z":"9a61955d.6927f8","group":"d920f16c.f3336","name":"highlightPict","order":1,"width":7,"height":5,"format":"<!DOCTYPE html>\n<html>\n<style type=\"text/css\"> \n.wrapper {\n    position:absolute;\n    width:320px;\n    height:240px;\n    border:2px solid grey;\n}\n.box {\n    position:absolute;\n    top:{{msg.y}}px;\n    left:{{msg.x}}px;\n    width:{{msg.width}}px;\n    height:{{msg.height}}px;\n    border:2px solid red;\n    background-color:transparent\n    z-index: 2;\n}\n.text {\n    position:absolute;\n    top:{{msg.y+5}}px;\n    left: {{msg.x+5}}px;\n    color: red;\n}\n</style> \n\n<script type=\"text/javascript\">\nscope.$watch('msg', function(msg) {\n    inMessage(msg);\n});\nfunction inMessage(event) {\n    if (event.payload) {\n        document.getElementById('cX').src = \"data:image/jpg;base64,\"+event.payload;\n    }\n}\n</script>\n\n<body>\n    <div class=\"wrapper\">\n        <img src=\"\" id=\"cX\" />\n        <div class=\"box\"></div>\n        <div class=\"text\">{{msg.class}}</div>\n    </div>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1130,"y":140,"wires":[[]]},{"id":"758e8b99.628f54","type":"ui_table","z":"9a61955d.6927f8","group":"d920f16c.f3336","name":"table detection","order":3,"width":7,"height":3,"columns":[{"field":"class","title":"Class","width":"40%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"score","title":"Score","width":"60%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":740,"y":200,"wires":[]},{"id":"7242bb6a.16a664","type":"change","z":"9a61955d.6927f8","name":"pay to detect","rules":[{"t":"move","p":"payload","pt":"msg","to":"detect","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":260,"wires":[["7e8b4bc4.f65cf4"]]},{"id":"7fb61cf1.74a9d4","type":"debug","z":"9a61955d.6927f8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":320,"wires":[]},{"id":"52d5e6be.efb998","type":"debug","z":"9a61955d.6927f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"classes","targetType":"msg","x":730,"y":360,"wires":[]},{"id":"79aaf955.461408","type":"delay","z":"9a61955d.6927f8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1120,"y":260,"wires":[["b3082738.d420d8"]]},{"id":"7e8b4bc4.f65cf4","type":"function","z":"9a61955d.6927f8","name":"posiRectangle","func":"var st = context.get('started')||false;\nvar reset = {reset:true};\n\nif (msg.detect.length>0) {\n    clearTimeout(st);\n    node.send(reset);\n    showBoxes();\n} else {\n    clearTimeout(st);\n    node.send(reset);\n}\n\nfunction writeBox(element) {\n    let box = element;\n    msg.x = box.bbox[0];\n    msg.y = box.bbox[1];\n    msg.width = box.bbox[2];\n    msg.height= box.bbox[3];\n    msg.class = box[\"class\"];\n    msg.score = box[\"score\"];\n    node.send(msg);\n}\n\nfunction showBoxes() {\n    msg.detect.forEach(element => writeBox(element))\n    st = setTimeout( showBoxes, msg.detect.length*2000 );\n    context.set('started', st);\n}","outputs":1,"noerr":0,"x":920,"y":260,"wires":[["79aaf955.461408"]]},{"id":"123cb42b.27cdac","type":"comment","z":"9a61955d.6927f8","name":"NR Object detection","info":"Example flow that fetches a random image (usually of a person) - displays it and classifies it. \n\nChange the http request to fetch other images if you like - for example change person to dog, or sport.\n\nThanks to @krambriw and @SuperNinja for the overlay code.","x":170,"y":100,"wires":[]},{"id":"d920f16c.f3336","type":"ui_group","z":"","name":"Object detection","tab":"eb19e1f8.cc986","disp":true,"width":7,"collapse":false},{"id":"eb19e1f8.cc986","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]